<!DOCTYPE html>
<html lang="zh-CN">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <div id="app">
        姓:<input type="text" v-model="firstName"></br>
        名:<input type="text" v-model="lastName"></br>
        <p>{{fullName}}
        </p>
    </div>
    <script src="./js/vue.js"></script>
    <script>
        const vm = new Vue({
            data: {
                firstName: "",
                lastName: "",
                fullName: "",
            },
            watch: {
                firstName(firstName) {
                    this.fullName = firstName + this.lastName;
                },
                lastName(lastName) {
                    this.fullName = this.firstName + lastName;
                }
            }
        });
        vm.$mount("#app");
    </script>
</body>

</html>